package main

import (
	"fmt"
)

type Person struct {
	Name string `json:"name"`  //结构体标签，用于序列化和反序列化
	age int
}

type Test struct {
	p *int
}

type TestInt struct {
	i int
	j int
}

func main()  {
	var p1 Person
	p1 = Person{"chen",1}
	fmt.Println(p1)

	p2 := Person{"jia",2}
	fmt.Println(p2)

	/*
		值类型用new分配内存
		引用类型用make分配内存
	*/
	var p3 *Person = new(Person)
	p3.Name = "bo"
	p3.age = 3
	fmt.Println(*p3)

	var p4 *Person = &Person{}
	p4.Name = "chen"
	p4.age = 4
	fmt.Println(*p4)

	var i int = 5
	t1 := Test{&i}
	var t2 *Test = &t1
	fmt.Println((*t2).p)
	fmt.Println(*t2.p)

	dizhi := TestInt{1,2}
	fmt.Printf("%v,%v\n",&dizhi.i,&dizhi.j)

}

